package com.gitee.wsl.struct.either.ext

import arrow.core.Either


/**
 * Returns the first successful either, otherwise the last failure
 */
inline fun <E, A> Either<E, A>.or(f: () -> Either<E, A>): Either<E, A> = when (this) {
    is Either.Left -> f()
    is Either.Right -> this
}